package com.alphaking.controller.admin;

import java.lang.ProcessBuilder.Redirect;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.alphaking.service.mingweicai.BlogService;
import com.alphaking.util.DataConvertorUtil;

@Controller
public class BlogAddController {

	@Resource
	private BlogService blogService;

	@RequestMapping("/admin/toAddBlogPage")
	public String toAddBlogPage(Model model) throws NoSuchFieldException, SecurityException {

		blogService.initCategorys(model);

		return "/admin/blogAdd";
	}

	@RequestMapping("/admin/addBlog")
	public String addBlog(Model model, String mapAttr) throws NoSuchFieldException, SecurityException {

		blogService.addBlog(mapAttr);

		return "redirect:/admin/toBlogListPage";
	}


}
